home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / private / _gcrspos.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  1.5 KB  |  64 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef PDCDEBUG
  5. char *rcsid__gcrspos = "$Header: C:\CURSES\private\RCS\_gcrspos.c 2.1 1993/06/18 20:22:41 MH Rel MH $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_get_cursor_pos()    - return current cursor position
  14.  
  15.   PDCurses Description:
  16.      This is a private PDCurses function
  17.  
  18.      Gets the cursor position in video page 0.  'row' and 'column'
  19.      are the cursor address.  At this time, there is no support for
  20.      use of multiple screen pages.
  21.  
  22.   PDCurses Return Value:
  23.      This routine will return OK upon success and otherwise ERR will be
  24.      returned.
  25.  
  26.   PDCurses Errors:
  27.      There are no defined errors for this routine.
  28.  
  29.   Portability:
  30.      PDCurses    int    PDC_get_cursor_pos( int* row, int* col );
  31.  
  32. **man-end**********************************************************************/
  33.  
  34. int    PDC_get_cursor_pos(int *row, int *col)
  35. {
  36. #ifdef PDCDEBUG
  37.     if (trace_on) PDC_debug("PDC_get_cursor_pos() - called\n");
  38. #endif
  39.  
  40. #ifdef    FLEXOS
  41.     retcode = s_get(T_VIRCON, 0L, (char *) &vir, (long) sizeof(vir));
  42.     if (retcode < 0L)
  43.         return( ERR );
  44.     *row = vir.vc_cursor.pos_row;
  45.     *col = vir.vc_cursor.pos_col;
  46.     return( OK );
  47. #endif
  48. #ifdef    DOS
  49.     regs.h.ah = 0x03;
  50.     regs.h.bh = _cursvar.video_page;
  51.     int86(0x10, ®s, ®s);
  52.     *row = regs.h.dh;
  53.     *col = regs.h.dl;
  54.     return( OK );
  55. #endif
  56. #ifdef    OS2
  57.     VioGetCurPos((PUSHORT)row,(PUSHORT)col,0);
  58.     return( OK );
  59. #endif
  60. #ifdef UNIX
  61. /* INCOMPLETE */
  62. #endif
  63. }
  64.